package xhwl.hmo.mall.http.api;

import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.hmo.mall.Constant;
import xhwl.hmo.mall.http.ApiService;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by admin on 2017/6/6.
 */

public class GetVerifyCodeApi extends BaseApi {
    GetSmsApiReq getSmsApiReq;

    public GetVerifyCodeApi(String link_phone, String sms_type, String post_ip) {
        getSmsApiReq = new GetSmsApiReq(link_phone, sms_type, post_ip);
        setShowDialog(true);
    }

    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(getSmsApiReq));
        return retrofit.create(ApiService.class).getVerifyCode(requestBody);
    }

    public class GetSmsApiReq {
        private String link_phone;
        private String sms_type;
        private String post_ip;
        private String client_id;

        public GetSmsApiReq(String link_phone, String sms_type, String post_ip) {
            this.link_phone = link_phone;
            this.sms_type = sms_type;
            this.post_ip = post_ip;
            this.client_id = Constant.Clientid;
        }
    }
}
